package com.littleu.yojoincn.controller.tt;

import com.littleu.yojoincn.model.BrandDO;
import com.littleu.yojoincn.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.Positive;
import java.util.List;

@RestController
@RequestMapping("/tt/brand")
@Validated
public class BrandController {
    @Autowired
    private BrandService brandService;

    @GetMapping("/market")
    public List<BrandDO> getMarketBrandList(){
        Integer isMarket = 1;
        return this.brandService.getByIsMarket(isMarket);
    }

    @GetMapping("/{id}")
    public BrandDO getBrandDetail(@PathVariable @Positive Long id){
        return this.brandService.getDetail(id);
    }
}
